FROM ubuntu:18.04

ARG SOFTWARE_BASE_URL

## use aliyun source
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
	&& sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
	&& apt clean \
	&& apt-get update -y \
    && apt-get clean && apt-get autoclean

RUN apt install -y openssh-server \
    && apt-get clean && apt-get autoclean

RUN mkdir /var/run/sshd && \
    mkdir /root/.ssh
    
# 修改 root 的密码为 123456
RUN echo 'root:123456' | chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
# expose port 22 
EXPOSE 22
# RUN /etc/init.d/ssh restart
CMD ["/usr/sbin/sshd", "-D"]